package com.zht.demo;
//import cn.ucox.web.framework.security.MD5Util;
import com.alibaba.fastjson.JSONObject;
import com.zht.utils.AESUtil;

import java.text.ParseException;
import java.util.*;

public class test3 {
    private   static   final   String  key="aesuizerkn!@#$%^";   //正式环境解密key

    private  static   final   String    iv="asdfghjklzxcvbnm";

    private static final String secretKey = "vuex/store";

//    private static final Logger LOGGER = LoggerFactory.getLogger(ConsultationServiceImpl.class);


    public static void main(String[] args) throws ParseException {

//        PageHelper.startPage()


        Map<String, String> map = new HashMap<>();
        long time = System.currentTimeMillis();
//        String oauth = (int) (Math.random() * 10) + UUID.randomUUID().toString().replace("-", "")
//                + cn.ucox.web.framework.security.MD5Util.md5Str(secretKey + time) + (int) (Math.random() * 10);
//        map.put("Content-Type", "application/json");
        String oauth = "11";
        map.put("oauth", oauth);
        map.put("timestamp", time + "");
        map.put("my", String.valueOf(true));
        Set<Map.Entry<String, String>> entries = map.entrySet();
        entries.stream().forEach(s -> System.out.println(s));


        String url = "http://172.16.2.24:8071/news/page?ps=%s&pi=%s&kw=%s";
        String url2 = "http://172.16.2.24:8071/news/news/%s";
        String url3 = "http://172.16.2.24:15555/base/dept/res-sub/%s";
        String url4 = "http://172.16.2.24:15555/base/captcha/verify/%s/%s";
        String url5 = "http://172.16.2.24:8889/consults/myconsult/page?ps=%s&pi=%s&sb=%s&sd=%s&q_creator_s_eq=%s&status=%s";

        JSONObject params = new JSONObject();
        params.put("ps","6");
        params.put("pi","1");
        params.put("kw","zcfb");
        params.put("guid","efe09ca7ecad457293120c3104ed926b");
        params.put("parent_id","370300000000");
        params.put("id","54f54f28d134b1cd10b8c115df587bbb");
        params.put("val","mdf5");


        params.put("ps","8");
        params.put("pi","1");
        params.put("sb","cos_time");
        params.put("sd","desc");
        params.put("q_creator_s_eq","3fc0dd87de594bd483c608d7ddad9627");
        params.put("status","");

         url = String.format(url,params.getString("ps"),params.getString("pi"),params.getString("kw"));
        System.out.println(url);

        url2 = String.format(url2,params.getString("guid"));
        System.out.println(url2);

        url3 = String.format(url3,params.getString("parent_id"));
        System.out.println(url3);

        url4 = String.format(url4,params.getString("id"),params.getString("val"));
        System.out.println(url4);


        url5 = String.format(url5,params.getString("ps"),params.getString("pi"),
                params.getString("sb"),params.getString("sd"),params.getString("q_creator_s_eq"),params.getString("status"));
        System.out.println(url5);

//        for (int i = 1; i <= 6000; i++) {
//            System.out.println("第" + i + "次");
//        }

        String encrypt = AESUtil.encrypt("18954149202");
        System.out.println("telephone:>>>"+encrypt);
//        String decrypt = AESUtil.decrypt("0c6Sp5+NDXyXjdD4S8+YSw==");
//        System.out.println(decrypt);
        // 姓名加密
        String name = AESUtil.encrypt("赵海涛");
        System.out.println("name>>>" + name);
        // 身份证号加密
        String idNumber = AESUtil.encrypt("130182200011201912");
        System.out.println("id>>>" + idNumber);





        String appId = "52010000016";
        String secret = "ff113f7eb6e6b5d0d75186d53099db0f";
        String createDate = "2023-08-07 16:33:00";
//        String sign = MD5Util.md5Str(createDate + appId + secret);

        String sign = "1";
        System.out.println("    \"createdate\":\"" + createDate + "\",\nsign:>>> "+ sign);
        System.out.println(sign);


        System.out.println("------------------------------------------------------------------------------------");

        String visit = "{\n" +
                "    \"succ\":true,\n" +
                "    \"code\":200,\n" +
                "    \"msg\":\"\",\n" +
                "    \"data\":20999999\n" +
                "}";
        Integer num = null;
        JSONObject json = JSONObject.parseObject(visit);
        if (json.getBoolean("succ")){
            num = (Integer) json.get("data");
        }
        Long aLong = Long.valueOf(num);
        System.out.println("aa>" + aLong);

        System.out.println(Long.valueOf(num));

        System.out.println("2222222222222222222222222222222222222222222222");
        Random random = new Random();
        // 生成随机的8位数字
        int min = 10000000; // 最小值（8位数字的最小值）
        int max = 99999999; // 最大值（8位数字的最大值）
        int randomNumber = random.nextInt(max - min + 1) + min;
        String vector = randomNumber + "";
        System.out.println(vector);


        System.out.println("====================================================");
        String at = " 赵海涛  ";
        System.out.println(at);
        String trim = at.trim();
        System.out.println(trim);


//        QueryInfo queryInfo = new QueryInfo();
//        queryInfo.setMethod("GET");
//        queryInfo.setUrl("http://56.32.4.148/docking/query/lawyerdict");
//        JSONObject json2 = JSONObject.parseObject(JSONObject.toJSONString(queryInfo));
//        System.out.println(json2);

//        List<String> list = new ArrayList<>();
//       list.addAll(Arrays.asList("1","2","3","4","5"));
//        for (String s : list) {
//            System.out.print(s + "  ");
//        }





//        long l = System.currentTimeMillis();
//
//        String str = "赵海涛&130182200011201912&18954149202&"+l+"";
//        System.out.println(str);
//
//        // 加密
//        String encrypt = STAESUtil.encrypt(str.toString(), key, iv)
//                .replace("\r", "")
//                .replace("\n", "")
//                .replace("+", "_")
//                .replace("/", "*");
//        System.out.println(encrypt);

      //   371329199912223018






//        StringBuilder  str = new StringBuilder();
//        str.append("卢立杰");
//        str.append("&");
//        str.append("371329199912223018");
//        str.append("&");
//        str.append("null");
//        str.append("&");
//        str.append(System.currentTimeMillis());
//        String sParam = STAESUtil.encrypt(str.toString(), key, iv)
//                .replace("\r", "")
//                .replace("\n", "")
//                .replace("+", "_")
//                .replace("/", "*");
//
//        System.out.println(sParam);


//        StringBuilder  str = new StringBuilder();
//        str.append("赵海涛");
//        str.append("&");
//        str.append("130182200011201912");
//        str.append("&");
//        str.append("null");
//        str.append("&");
//        str.append(System.currentTimeMillis());
//        System.out.println(str);
//        String sParam = STAESUtil.encrypt(str.toString(), key, iv)
//                .replace("\r", "")
//                .replace("\n", "")
//                .replace("+", "_")
//                .replace("/", "*");
//
//        System.out.println(sParam);





//        int a = 6;
//        String b = "18954149202";
//
//
//        if(a > 3 && !("18669659996".equals(b))
//                && !("13210067706".equals(b))
//                && !("18954149202".equals(b))
//                && !("15949895725".equals(b))
//                && !("18300504736".equals(b)) ){
////
//            System.out.println("666");
//        }
//        System.out.println("777");

//        String encrypt = AESUtil.encrypt("37028419830304363X");
//        System.out.println(encrypt);

//        String decrypt = DesUtils.encrypt("37028419830304363X");
//        System.out.println(decrypt);



//        SimpleDateFormat sm = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
//        SimpleDateFormat sd = new SimpleDateFormat("yyyy/MM/dd");
//        SimpleDateFormat smt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        SimpleDateFormat sdt = new SimpleDateFormat("yyyy-MM-dd");
//
//        String date = "2023-6-1";
//        String format = sd.format(sdt.parse(date));
//        System.out.println(format);


//        long time = System.currentTimeMillis();
//
//        SecureRandom random = null;
//        try {
//            random = SecureRandom.getInstance("SHA1PRNG");
//        } catch (NoSuchAlgorithmException e) {
//            // logger.info(e.getMessage());
//        }
//        int rdm = random.nextInt(10);
//        int rdm2 = random.nextInt(10);
//
//        String oauth = rdm + UUID.randomUUID().toString().replace("-", "") + MD5Util.md5Str("vuex/store"+time) + rdm2;
//        System.out.println(oauth);



//        long time = System.currentTimeMillis();
//        String oauth = (int)(Math.random() * 10) + UUID.randomUUID().toString().replace("-", "") + MD5Util.md5Str("vuex/store"+time) + (int)(Math.random() * 10);
//        System.out.println(oauth);
//        System.out.println(time);

//        Calendar instance = Calendar.getInstance();
//        instance.add(Calendar.DATE,-2);
//        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
//        String format = simpleDateFormat.format(instance.getTime());
//        System.out.println(format);

    }
}
